<script src="/static/layui/2.8.15/layui.js"></script>、
<script type="text/javascript">
    layui.use(['layer', 'form', 'jquery'], function () {
        let $ = layui.jquery, form = layui.form;
        $("input[name='keyword']").on('keydown', function (event) {
            let keyword = $("input[name='keyword']").val();
            if (event.keyCode === 13) {
                if (keyword === '') {
                    return false;
                }
                location.href =  '/search.html?keyword=' + keyword;
                return false;
            }
        });
        form.on('submit(doSearch)', function () {
            let keyword = $("input[name='keyword']").val();
            if (keyword !== '') {
                location.href =  '/search.html?keyword=' + keyword;
                return false;
            }
        });
    });
</script>